<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/taglib.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0"/>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>MCU MANAGER</title>
	<%@ include file="/WEB-INF/jsp/common/cssjs2.jsp" %>
	
	<script type="text/javascript">
		$(function(){
			$('.easyui-validatebox').validatebox();
			$('.easyui-validatebox[required]').after("<font color='red'> *</font>");
			
			initIface();
		});
		
		function doSubmit(){
			$('#id_form').form('submit', {
		        url:"<c:url value='/app/setup/routes/route'/>",
		        onSubmit: function(){
		        	if($('.easyui-validatebox').validatebox("isValid")==false){
		        		return false;
		        	}else{
						return true;
					}
		        },
		        success:function(data){
					alert(data);
					parent.networkRouteViewObj.reload();
					parent.closeWin();
		        }
			});
		}
		
		function initIface(){
			$.ajax({
				url:"<c:url value='/app/setup/network/address/json' />",
				type:"GET",
				data:{
					times:new Date().valueOf()
				},
				success:function(data){
					var netAddressObj=$.parseJSON(data);
					var $sel=$("select[name=iface]");
					
					$sel.append('<option value="eth0">eth0</option>');
					if(netAddressObj.hasif1==true||netAddressObj.hasif1=='true'){
						$sel.append('<option value="eth1">eth1</option>');
					}
				}
			});
		}
	</script>
	
	<style type="text/css">
	    html, body,form {
	        width: 100%;
	        height: 100%;
	        margin: 0px;
	        overflow: hidden;
	    }
	</style>
</head>
<body class="dialog">
<form id="id_form" method="post">
<table border="0" style="width:100%;text-align:left;font-size:12px;margin:5px;" cellpadding="3" cellspacing="0">
	<tbody>
		<tr>
			<td width="30%"><fmt:message key='setup.routes.route.net'/></td>
			<td width="70%"><input type="text" name="net" class="easyui-validatebox" required="true" validtype="ip" /></td>
		</tr>
		<tr>
			<td width="30%"><fmt:message key='setup.routes.route.netmask'/></td>
			<td width="70%"><input type="text" name="netmask" class="easyui-validatebox" required="true" validtype="ip" /></td>
		</tr>
		<tr>
			<td width="30%"><fmt:message key='setup.routes.route.iface'/></td>
			<td width="70%">
			<select name="iface" class="easyui-validatebox" required="true"></select>
			</td>
		</tr>
		<tr>
			<td colspan="2">
                <input type="button" onclick="doSubmit();" class="mybtn" value="<fmt:message key='btn.ok'/>">
				<button onclick="parent.closeWin();" class="mybtn"><fmt:message key='btn.cancel'/></button>
			</td>
		</tr>
	</tbody>
</table>
</form>
</body>
</html>